package com.woniuxy.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import com.woniuxy.entity.WareHousing;
@Mapper
public interface WareHousingMapper {
	
	//查询所有入库
	@Select("select * from t_warehousing")
	public List<WareHousing> findWareHousing();
	
	//查询指定单号,入库详情
	@Select("select * from t_warehousing where worder=#{worder}")
	public List<WareHousing> findWareHousingDeatilById(String worder);
	
	//新增入库单
	@Insert("insert into t_warehousing values(default,#{worder},#{cgname},#{cname},#{fname},"
			+ "#{aname},#{status},#{qname},#{weight},#{num},#{pname},#{sname},#{mtime},#{mname})")
	public int insertWarehousing(WareHousing wareHousing);
	
	//查询指定单号,入库详情
	@Select("select * from t_warehousing where cgname=#{cgname}")
	public List<WareHousing> findWareHousingByCgname(String cgname);
	
	//单品转通品
	@Update("update t_warehousing set cgname = '通品' where worder = #{worder}")
	public int updateWarehousing(String worder);
	
	//通品转单品
	@Update("update t_warehousing set cgname = '单品' where worder = #{worder}")
	public int updateWarehousing_tp(String worder);
	
	@Delete("delete from t_warehousing where worder=#{worder}")
	public int deleteWarehousing(String worder);
}
